﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EARTHLib;

namespace PolePosition.v3.GoogleEarth
{
    public class CameraInfo
    {
        ApplicationGEClass m_GoogleEarth;
        public CameraInfo(ApplicationGEClass googleEarth)
        {
            m_GoogleEarth = googleEarth;
        }

        public void SetPosition(double latitude, double longitude, double altitude)
        {
            m_GoogleEarth.SetCameraParams(
                latitude,
                longitude,
                altitude < 7000 ? 10000 : altitude,
                AltitudeModeGE.RelativeToGroundAltitudeGE, 0, 0, 0, 1);
        }

        public void ResetPosition()
        {
            int _ZoomLevel;
            _ZoomLevel = 10000000;

            PointOnTerrainGE _PointOnTerrainGE;
            _PointOnTerrainGE = m_GoogleEarth.GetPointOnTerrainFromScreenCoords(0, 0);

            m_GoogleEarth.SetCameraParams(
                _PointOnTerrainGE.Latitude,
                _PointOnTerrainGE.Longitude,
                _PointOnTerrainGE.Altitude,
                AltitudeModeGE.RelativeToGroundAltitudeGE,
                _ZoomLevel, 0, 0, 1);
        }

        public MapPosition CurrentPositon
        {
            get;
            set;
        }
    }
}
